#ifndef _demoks_dis_net_h_
#define _demoks_dis_net_h_

#define DEMOSK_ACCESS_NAT_X_ACCESS_TOKEN "TdVmqLfSXsUPkCDNYygsMcj8mgaBuYLD"
#define CHECK_X_ACCESS_TOKEN(s) strcmp(s, DEMOSK_ACCESS_NAT_X_ACCESS_TOKEN) == 0 ? DEMOSK_ACCESS_NAT_CODE_SUCCESS : DEMOSK_ACCESS_NAT_CODE_TOKEN_INVALID

#define DEMOSK_ACCESS_NAT_HTTP_SERVER_PORT 14593 /** http 端口号 */
#define DEMOSK_ACCESS_NAT_AP_TIME_OUT 180        /** ap模式等待超时 */
#define DEMOSK_ACCESS_NAT_HTTP_SERVER_MAX_DIS 3  /** 配网时最大重连次数 */
#define DEMOSK_ACCESS_NAT_ERROR_MAX_RESET 3      /** 配网时错误重试次数 */

typedef enum
{
    DEMOSK_ACCESS_NAT_CODE_SUCCESS = 0,         /** 请求成功 */
    DEMOSK_ACCESS_NAT_CODE_TOKEN_INVALID = -1,  /** TOKAN无效 */
    DEMOSK_ACCESS_NAT_CODE_GET_SSID_FAIL = -2,  /** 获取WIFI列表失败 */
    DEMOSK_ACCESS_NAT_CODE_GET_SSID_EMPTY = -3, /** 搜索不到附近的SSID */
    DEMOSK_ACCESS_NAT_CODE_ERROR_JSON = -4,     /** 错误JSON格式 */
    DEMOSK_ACCESS_NAT_CODE_WIFI_DIS_FAIL = -5,  /** WIFI连接失败, 请检查passwd是否正确 */
} demoks_access_nat_code_t;

typedef enum
{
    WIFI_DISTRIBUTION_EVENT_CODE_NONE = 0,    /** 空事件 */
    WIFI_DISTRIBUTION_EVENT_CODE_SUCCESS = 1, /** 连接WIFI成功 */
    WIFI_DISTRIBUTION_EVENT_CODE_FAIL = 2,    /** 连接WIFI失败 */
} wifi_distribution_event_code_t;

typedef enum
{
    DEMOSK_ACCESS_NAT_EVENT_CODE_NONE = 0,           /** 空事件 */
    DEMOSK_ACCESS_NAT_EVENT_CODE_WIFI_ACC_SUCC,      /** WIFI连接成功 */
    DEMOSK_ACCESS_NAT_EVENT_CODE_WIFI_ACC_FAIL,      /** WIFI连接失败 */
    DEMOSK_ACCESS_NAT_EVENT_CODE_AP_STAIPASSIGNED,   /** 连接的站分配IP */
    DEMOSK_ACCESS_NAT_EVENT_CODE_AP_STACONNECTED,    /** 站点接入了AP */
    DEMOSK_ACCESS_NAT_EVENT_CODE_AP_STADISCONNECTED, /** 站点断开了AP */
    DEMOSK_ACCESS_NAT_EVENT_CODE_WAIT_TOMEOUT,       /** 等待超时了 */
    DEMOSK_ACCESS_NAT_EVENT_CODE_FAIL,               /** 配网失败 */
} demoks_access_net_event_code_t;

/**
 * 初始化配网模式
 * AP + HTTP
 */
void demoks_access_net_ap_http_init(void);
void demoks_access_net_stop(void);
#endif
